#include <QtGui>
#include "qmethodx.h"
#include "ui_qmethodx.h"
#include "xcalculate.h"

QMethodX::QMethodX(QWidget *parent) :
    QWidget(parent),
	ui(new Ui::QMethodX)
{
    ui->setupUi(this);
}

QMethodX::~QMethodX()
{
    delete ui;
}
void QMethodX::go(CFuncX *f, const Piped &p, vector<double> &min, list<vector<double> > &experiments)
{
	CXCalculate s;
	Params param = paramDefault;
//void go(CFunc *f, double a, double b, double *reps, int *rstep, QPointF *min, list<QPointF> *experiments)
//	int number_method = ui->comboBox->currentIndex();
//	int number_lip = ui->comboBox_2->currentIndex();
//
//	int steps = ui->lineEdit_steps->text().toInt();
//	double epsilon = ui->lineEdit_epsilon->text().toDouble();
//	int number_threads = ui->lineEdit_threads->text().toInt();
//	bool isAdaptLip = (number_lip == 1);
//	double m = ui->lineEdit_lip->text().toDouble();
//	double r = m;
//	//output
//	double &realepsilon = *reps;
//	int &realsteps = *rstep;
//	double XMin;
//	double YMin;
//	list<QPointF> &Labels = *experiments;
//
//	switch(number_method)
//	{
//		//serial-----------------
//	case 0:
//		{
//			CScan A;
//			A.calculate(f, a, b, steps, epsilon, m, r, isAdaptLip, realepsilon, realsteps, XMin, YMin, Labels);
//		}
//		break;
//	case 1:
//		{
//			CLom A;
//			A.calculate(f, a, b, steps, epsilon, m, r, isAdaptLip, realepsilon, realsteps, XMin, YMin, Labels);
//		}
//		break;
//	case 2:
//		{
//			CStrongin A;
//			A.calculate(f, a, b, steps, epsilon, m, r, isAdaptLip, realepsilon, realsteps, XMin, YMin, Labels);
//		}
//		break;
//		//omp----------------------------
//	case 3:
//		{
//			CScanOMP A;
//			A.calculateOMP(f, a, b, steps, epsilon, m, r, isAdaptLip, number_threads, realepsilon, realsteps, XMin, YMin, Labels);
//		}
//		break;
//	case 4:
//		{
//			CLomOMP A;
//			A.calculateOMP(f, a, b, steps, epsilon, m, r, isAdaptLip, number_threads, realepsilon, realsteps, XMin, YMin, Labels);
//
//		}
//		break;
//	default:
//		{
//			CStronginOMP A;
//			A.calculateOMP(f, a, b, steps, epsilon, m, r, isAdaptLip, number_threads, realepsilon, realsteps, XMin, YMin, Labels);
//
//		}
//		break;
//	}
//	min->setX(XMin);
//	min->setY(YMin);
//
	param.isAdaptiveConstLip = (ui->comboBox_2->currentIndex() == 1);
	param.steps = ui->lineEdit_steps->text().toInt();
	param.epsilon = ui->lineEdit_epsilon->text().toDouble();
	param.m = ui->lineEdit_lip->text().toDouble();
	param.r = param.m;
	s.operator ()(f, p, min, experiments, param);
	return;
}
